package com.icloud.common.database.enums;

import lombok.Getter;

@Getter
public enum DeleteEnum {
    DELETED(1),
    NORMAL(0);

    private final Integer code;

    DeleteEnum(Integer code){
        this.code = code;
    }

    public static DeleteEnum byCode(Integer code) {
        for (DeleteEnum e: DeleteEnum.values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return null;
    }

    public static boolean isNormal(Integer code){
        return NORMAL.getCode().equals(code);
    }
    public static boolean isDeleted(Integer code){
        return DELETED.getCode().equals(code);
    }
}
